<!-- eslint-disable no-console -->
<script setup lang="ts">
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import { appName } from '~/constants'

const layout: any = ref('default')

const route = useRoute()
onMounted(() => {
  setLayout()
})
function setLayout() {
  const pathArr = route.name.split('-')
  const path = pathArr[0]
  if (path === 'login')
    layout.value = 'login'
  else layout.value = 'default'
}

watch(
  () => route.path,
  () => {
    setLayout()
  },
)

useHead({
  title: appName,
})
</script>

<template>
  <VitePwaManifest />
  <el-config-provider :locale="zhCn">
    <NuxtLayout :name="layout">
      <NuxtPage />
    </NuxtLayout>
  </el-config-provider>
</template>

<style>
html,
body,
#__nuxt {
  height: 100vh;
  margin: 0;
  padding: 0;
  background-color: #f2f3f7;
}

/* 设置滚动条的样式 */
::-webkit-scrollbar {
  width: 5px;
  height: 10px;
}

/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
  border-radius: 10px;
  height: 25px;
  background: #d5d7db;
}
</style>
